#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++) 
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;

int read() {
	int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-', ch = getchar(); 
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar(); return f ? -x : x;
}

const int N = 2010;
const int mod = 1e9 + 7;

int f[N << 1][N], n, m, K;
inline int upd(int x) { return x + (x >> 31 & mod); }

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in, m = in, K = in;
	rep(i, 1, K - 1) f[1][i] = 1;
	int t = (n + m - 1) / (K - 1);
	rep(i, 2, t) {
		rep(j, 1, n) {
			f[i][j] = upd(f[i][j - 1] + f[i - 1][j] - mod);
			if(j >= K) f[i][j] = upd(f[i][j] - f[i - 1][j - K]);
		}
	}
	int ans = 0;		  
	rep(i, 1, t) {
		int ed = max(0, i * (K - 1) - m) + 1;
		per(j, n, ed) {
			ans = upd(ans + f[i][j] - mod);
			j -= K - 2;
		}
	}
	cout << ans << endl;
	return 0;
}
